
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%> 
<%@ include file="/include/head.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript" src="<%=request.getContextPath()%>/resources/servicePro/jquery.uploadify.min.js"></script>
<link rel="stylesheet" href="<%=request.getContextPath()%>/resources/servicePro/uploadify.css">
<script type="text/javascript">
$(function () {
 getProData() ;
 getCityData() ;
  $("#file_upload").uploadify({
        		    'buttonText' : '请选择默认头像',
        		    'height' : 30,
        	        'swf' : '<%=request.getContextPath()%>/resources/servicePro/uploadify.swf',
        	        'uploader' : '<%=request.getContextPath()%>/back/actBack/upload.do?type=school',
        	        'width' : 120,
        	        'multi'           : false,
                    "auto"            : false,
                    "dnd"             : true,
        	        "fileTypeExts"    : "*.png;*.jpg;*.bmp;*.gif",
                    "fileSizeLimit"   : "2MB",
        	        'fileObjName'   : 'file',
        	        'onUploadSuccess' : function(file, data, response) {
        	        	      data = eval("(" + data + ")");      	        
        	                 alert( file.name + ' 上传成功！ ');
                           $("#iphoto").val(data.picurl);
                            $("#iifUpPic").val("1");
        	            $("#uploadButton").hide();
        	            
        	        },
         'onFallback' : function() {
           alert('Flash was not detected.');
        },
         "onSelect" : function(file) {
          if ($("#file_upload-queue").children().length == 2) {
            $("#uploadButton").show();
          } else {
            $("#uploadButton").show();
          }
        },
           "onCancel" : function() {
          if ($("#file_upload-queue").children().length == 2) {
            $("#uploadButton").show();
          } else if ($("#file_upload-queue").children().length == 2) {
            $("#uploadButton").show();
          } else {
            $("#uploadButton").show();
          }
        },
 		        });
 		        $("#file_upload1").uploadify({
        		    'buttonText' : '请选择默认图片',
        		    'height' : 30,
        	        'swf' : '<%=request.getContextPath()%>/resources/servicePro/uploadify.swf',
        	        'uploader' : '<%=request.getContextPath()%>/back/actBack/upload.do?type=school',
        	        'width' : 120,
        	        'multi'           : false,
                    "auto"            : false,
                    "dnd"             : true,
        	        "fileTypeExts"    : "*.png;*.jpg;*.bmp;*.gif",
                    "fileSizeLimit"   : "2MB",
        	        'fileObjName'   : 'file',
        	        'onUploadSuccess' : function(file, data, response) {
        	        	      data = eval("(" + data + ")");      	        
        	                 alert( file.name + ' 上传成功！ ');
                           $("#iphoto1").val(data.picurl);
                            $("#iifUpPic1").val("1");
        	            $("#uploadButton1").hide();
        	            
        	        },
         'onFallback' : function() {
           alert('Flash was not detected.');
        },
         "onSelect" : function(file) {
          if ($("#file_upload-queue").children().length == 2) {
            $("#uploadButton1").show();
          } else {
            $("#uploadButton1").show();
          }
        },
           "onCancel" : function() {
          if ($("#file_upload-queue").children().length == 2) {
            $("#uploadButton1").show();
          } else if ($("#file_upload-queue").children().length == 2) {
            $("#uploadButton1").show();
          } else {
            $("#uploadButton1").show();
          }
        },
 		        });
});



        function getProData()  
	    {  
	        $.ajax({          
	             url:"<%=request.getContextPath()%>/back/school/getPro.do",  
	             type : "post",    
	             cache : false,    
	             dataType : "json",   
	             error:function(){  
	             },  
	             success:function(data){
	                var categoryId = document.getElementById('proName');  
	                //清空数组  
	                categoryId.length = 0;  
	                for(var i=0;i<data.length;i++){  
	                     var xValue=data[i].id;    
	                     var xText=data[i].name;    
	                     var option=new Option(xText,xText);    
	                     categoryId.add(option);    
	                }  
	               
	           }  
	       });  
	    }
	     function getCityData()  
	    {  
	        var pid = $("#proName").val();  
	        $.ajax({          
	             url:"<%=request.getContextPath()%>/back/school/getCity.do", 
	             data: {"proId":pid}, 
	             type : "post",    
	             cache : false,    
	             dataType : "json",   
	             error:function(){  
	             },  
	             success:function(data){
	            
	                var categoryId = document.getElementById('cityName');  
	                //清空数组  
	                categoryId.length = 0;  
	                for(var i=0;i<data.length;i++){  
	                     var xValue=data[i].id;    
	                     var xText=data[i].name;    
	                     var option=new Option(xText,xText);    
	                     categoryId.add(option);    
	                }  
	               
	           }  
	       });  
	    }
	    
	     
   </script>
<title>名校添加</title>


</head>
<body  >
	 
		<form action="<%=request.getContextPath()%>/back/school/add.do" method="post">
		<!-- 添加学校信息 -->
		<div class="box span10 oh">
			<table class="list_table"  id="tb_version_update" >
				<tr class="tr">
					<td align="left">&nbsp;&nbsp;学校名称:</td>
					<td>
					<input type="text" id="schoolName" name="schoolName"
										class="input-text_popup_form" style="width:300px" maxlength="50"
										>
										
										</td>
				</tr>
	            <tr class="tr">
					<td align="left">&nbsp;&nbsp;省份:</td>
					<td> 
						 <select name="proName" id="proName" class="input-text_popup_form"  style="width:300px" maxlength="150" onchange="getCityData();">
     					 </select>				
					</td>
				</tr>
				<tr class="tr">
					<td align="left">&nbsp;&nbsp;城市:</td>
					<td> <select name="cityName" id="cityName" class="input-text_popup_form"  style="width:300px" maxlength="150" >
     					 </select>		</td>
				</tr>
				<tr class="tr">
					<td align="left">&nbsp;&nbsp;默认头像:</td>
					<td>
					<div>
							<input type="file" name="fileName" class="ml10" style="height:36px;" id="file_upload" /> 
							<input id="uploadButton" type="button"
								onclick="$('#file_upload').uploadify('upload');" value="开始上传"
								class="ext_btn ext_btn_success" style="display:none;">
							<input type="text" id="iphoto"   name="schoolLogo"/>
							<input type="hidden" id="iifUpPic"   value="0" />
							</div>
                    </td>
				</tr>
				<tr class="tr">
					<td align="left">&nbsp;&nbsp;默认图片:</td>
					<td><div>
							<input type="file" name="fileName1" class="ml10" style="height:36px;" id="file_upload1" /> 
							<input id="uploadButton1" type="button"
								onclick="$('#file_upload1').uploadify('upload');" value="开始上传"
								class="ext_btn ext_btn_success" style="display:none;">
							<input type="text" id="iphoto1"   name="schoolPic"/>
							<input type="hidden" id="iifUpPic1"   value="0" />
							</div></td>
				</tr>
				<tr class="tr">
					<td align="left">&nbsp;&nbsp;学校简介:</td>
					<td><textarea id="schoolAbstr" name="schoolAbstr"  
										class="input-text_popup_form pl10 ml10"
						style="height:200px;width:90%;"
										></textarea></td>
				</tr>
				 <tr class="tr"   >
					<td align="center" colspan="2"> <input type="submit" value="添加" class="new_btn new_btn_publish new_btn_big"   id="sub"> </td>
				</tr>
			</table>
		</div>
		
		</form>
</body>

</html>
